package com.c2c.converter;

import com.c2c.po.enums.impl.CommentsState;
import com.c2c.po.enums.impl.ComplaintsState;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class ComplaintsStateConverter implements Converter<Integer, ComplaintsState> {


    @Override
    public ComplaintsState convert(Integer integer) {
        for (ComplaintsState complaintsState : ComplaintsState.values()){
            if (complaintsState.getCode() == integer){
                return complaintsState;
            }
        }
        return null;
    }

}
